package leetcode;

/**
 * Created by Ghost on 2014/11/21.
 */
public class Length_of_Last_Word {
    public int lengthOfLastWord(String s) {
        if(s==null || s.isEmpty())
            return 0;
        String[] Ss = s.split(" ");
        if(Ss.length>0){
            String last = Ss[Ss.length-1];
            return last.length();

        }
        else
            return 0;

    }
    public static void main(String[] args){
        Length_of_Last_Word length_of_last_word = new Length_of_Last_Word();
        System.out.println(length_of_last_word.lengthOfLastWord(" "));
    }
}
